import { PageParams } from '@/api/model/pageParams';
import { request } from '@/utils/request';

const page = async (params: PageParams) => {
  return request.post({
    url: '/sysRole/page',
    data: params,
  });
};

const insertApi = async (data: any) => {
  return request.post({
    url: '/sysRole/insert',
    data,
  });
};

const updateApi = async (data: any) => {
  return request.post({
    url: '/sysRole/update',
    data,
  });
};

const deleteById = async (id: string) => {
  return request.get({
    url: `/sysRole/delete/${id}`,
  });
};

const batchDeleteById = async (ids: Number[]) => {
  return request.post({
    url: '/sysRole/batch',
    data: {
      ids,
    },
  });
};

export { batchDeleteById, deleteById, insertApi, page, updateApi };
